import 'package:flutter/cupertino.dart';
import 'package:xiongan_app_yy/common/user_singleton.dart';
import 'package:xiongan_app_yy/entrys/rp/erp_odd_numbers_entity.dart';
import 'package:xiongan_app_yy/entrys/rp/inv_counter_details_entity.dart';
import 'package:xiongan_app_yy/entrys/rp/inv_list_details_entity.dart';
import 'package:xiongan_app_yy/entrys/rp/return_booking_entity.dart';
import 'package:xiongan_app_yy/net/internet_api.dart';


class CounterInfo extends ChangeNotifier {
  //记录清点数据
  List<InvCounterDetailsData> _data=List();
  bool _netStatus1 = false;

  //getter方法获取数据
  get data=>_data;
  get netStatus1=>_netStatus1;

  set setNetStatus1(bool value) {
    _netStatus1 = value;
    notifyListeners();
  }


  setMaterialsnid(List<InvCounterDetailsDatasInorderdetailsnlist> bean,int i) {
    data.elementAt(i).inOrderDetailSnList=bean;
    notifyListeners();
  }
  void getData(String id) {
    //初始化数据和加载状态
    _netStatus1=true;
    _data=[];
    notifyListeners();
    InternetAPI.getInstance().get("WMS/MiWarehouseInOrder/GetCheckMaterialList",
            (data) {
          InvCounterDetailsEntity bean=InvCounterDetailsEntity.fromJson(data);
          _netStatus1=false;
          _data=bean.datas;
          notifyListeners();
        }, params: {
          'orderid':id,
          'operaterUserId': DataSingleton().Data.id,
          'userId': DataSingleton().Data.id,
          'tenantId': DataSingleton().Data.tenantId,
          'warehouseid': DataSingleton().warehouseChoice.id,
          'pageNo': -1
        });
  }
}
